﻿using Architecture.CrossCutting.RepositoryPattern.Specification;
using Architecture.Domain.TestModel.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Architecture.Domain.BankManagement.QuerySpecifications
{
    public static class CountriesSpecification
    {
        public static DirectSpecification<Country> CountryByName(String name)
        {
            return new DirectSpecification<Country>(c => c.Name.Equals(name.ToUpper()));
        }
        public static DirectSpecification<Country> CountryByCodeIso(String codeISO)
        {
            return new DirectSpecification<Country>(c => c.CodeISO.Equals(codeISO.ToUpper()));
        }

        public static ISpecification<Country> ExistingCountry(String name, String codeISO)
        {
            Specification<Country> specification = new TrueSpecification<Country>();

            specification &= (CountryByName(name) && CountryByCodeIso(codeISO));
            return specification;
        }

    }
}
